<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        body{
            width: 100%;
            height: 100%;
        }
        .out{
            width:100%;
            height:800px;
        }
        .top div{
            margin-left:20px;
            float: left;
        }
        table{
            margin:auto;
            margin-top:20px;
        }
        .bottom{
            margin:auto;
            /*border: 1px solid red;*/
            margin-left:40%;
            margin-top:50px;
        }
        .bottom input{
            width:40px;
            margin-left:30px;
            margin-right:30px;
        }
        .select{
            margin-left: 150px;
        }
    </style>
</head>
<body>
    <div class="out">
    <div class="top">
        <div class="name">
            <span>员工姓名</span>
            <input type="text" name="employeeName" class="employee.e_name"/>
        </div>
        <div class="sex">
            <span>性别</span>
            <input type="text" name="employeeSex" class="employee.e_sex"/>
        </div>
        <div class="department">
            <span>工作部门</span>
            <select name="employee.d_id" class="employee_id">
              <option></option>
              <option value="1">1</option>
              <option value="2">2</option>
            </select>
        </div>
        <div class="month">
            <span>月份</span>
            <input type="text" name="employeeMonth" class="month"/>
        </div>
        <button class="select">搜索</button>
    </div>
    <div class="table">
   </div>
    </div>
    <div onclick="add()">添加</div>
</body>
<script type="text/javascript" src="../JS/jquery.1.9.1.js"></script>
<script>
function submit(a){
    var name = $(".employee.e_name").val();
    var sex =$(".employee.e_sex").val();
    var id=$(".employee_id").val();
    var Month = $(".month").val(); 
    var crrentPage = $(".currentPage").val();
    if(id==null){
    	id=1;
    }
    alert(id);
	if(a==1){
	    currentPage++;	
	}else if(a==0){
		currentPage--;
	} 
	$(".table").empty();
	$.ajax({
	   type:"post",
	   url :"../rewardAndpunishShow.action",
	   data:{
			  "employee.e_name":name,
			  "employee.e_sex":sex,
			  "employee.d_id":id,	  
			  month:Month,
	   },
	   dataType:"html",
	   success:function(data){
		   alert(data);
		   $($.parseHTML(data, document, true)).appendTo($(".table"));       
	   },
	   error:function(){
		   alert("失败");
	   }
	});	
}
submit(3);

function add(){
	window.location.href="rewardstableAdd.jsp";
}
function remove(a){
	$.ajax({
		   type:"post",
		   url :"../rewardAndpunishRemove.action",
		   data:{
			   "r_id":a,
		   },
		   dataType:"json",
		   success:function(data){
			    if(data=="成功"){
			    	alert("录入成功");
			    }else{
			    	alert("录入失败");
			    }
		   },
		   error:function(){
			   alert("失败");
		   }
		});	
}
</script>
</html>